<template>
	<div>
		<el-dialog
			@closed="closed"
			title="查看订单"
			:visible.sync="dialogVisible"
			@opened='openDialog'
			:width="myWidth"
			:before-close="handleClose"
			class="look_order"
			id = 'js_lookOrder'
			ref='jsLookOrder'>
			<!-- 查看的 -->
			<el-row v-if="show_process" class="mb10">
				<el-steps :active="opDateMax" class="steps" :process-status='step_status' finish-status="success" align-center style="margin-top: 20px">
					<el-step v-for="(item,index) in steps_text"   :title="item" description="" :key="index"></el-step>
				</el-steps>
			</el-row>
			<el-row :gutter="24">
				<el-col :span="setLeft_form">
					<div class="grid-content bg-purple">
						<div class="btn_chageAgent btn_chage" v-if="role_id!=2 && role_id != 3">
							<el-button v-if="(role_id==1 || role_id == 7) && !formProcess" type="danger" @click="delOrderFn" v-no-more-click:3000>删除</el-button>
							<el-button v-if="status == '处理中' && !formProcess" type="danger" icon="el-icon-edit" @click="chageAgent(form)">变更代理人</el-button>
							<!-- :disabled="(getProcessingTime(form)).split('天')[0] > 10" -->
							<el-button
								v-if="(status == '处理中' || status == '待接单' && form.status != '等待提交国知局') && !formProcess"
								type="danger"
								icon="el-icon-edit"
								@click="closeOrder" v-no-more-click:3000>结束流程
							</el-button>

							<el-button v-if="status == '待接单'" type="danger" icon="el-icon-edit" @click="distributionAgent(form.id)" v-no-more-click:3000>分配代理人</el-button>
							<el-button v-if="(role_id == 4 || role_id == 7) && isOrder(form.order)" icon="el-icon-edit" type="danger" @click="editOrder" v-no-more-click:3000>修改订单</el-button>
							<el-button v-if="(role_id == 4 || role_id == 7) && formProcess && form.consumer_pay_status == 2" type="danger" @click="sureHasPay" v-no-more-click:3000>确认缴款</el-button>
							<el-button v-if="(role_id == 4 || role_id == 7) && formProcess" type="danger" @click.stop="update(form)" v-no-more-click:3000>更新订单</el-button>
							<el-button v-if="(role_id == 4 || role_id == 7) && formProcess" type="danger" @click.stop="editAgent(form)" v-no-more-click:3000>修改代理人</el-button>
							<el-button v-if="(role_id == 4 || role_id == 7) && formProcess && !form.order" icon="el-icon-edit" type="danger" @click.stop="supplementOrder(form)" v-no-more-click:3000>补充订单</el-button>
							<el-button v-if="role_id == 1 && !formProcess" type="danger" icon="el-icon-edit" @click.stop="updateOrderStatus(form)" v-no-more-click:3000>修改状态</el-button>

							<el-button v-if="(role_id == 4 || role_id == 7) && formProcess && form.status == '等待提交国知局'" type="danger" @click="createCPC(form)" v-no-more-click:3000>生成CPC文件</el-button>
						</div>
						<div class="btn_chageAgent btn_chage"  v-if="role_id == 2">
							<el-button type="danger" v-if="status == '处理中'" @click="orderRescind" :disabled="form.reason != null || sumDate > 10" v-no-more-click:3000>撤案申请</el-button>
							<el-button type="danger" v-if="form.status == '案件内审中' && $store.state.user.is_teacher != 2" @click="resetFile">撤回内审文件</el-button>
							<el-button type="primary" v-if='form.is_distribution == 3 && !form.order_pay' @click="goPay">去支付</el-button>
							<!-- :disabled="withdrawDisabled(form)" -->
							<el-button v-if="form.status == '文件格式审核中'"  type="danger" @click.stop="withdrawCompleteFile(form)" v-no-more-click:3000>撤回上报文件</el-button>
							<el-button v-if="$store.state.user.is_teacher == 1 && form.status == '代理人撰写中'" :disabled='canAllocationOrder' type="danger" @click.stop="distributeOrder(form)" v-no-more-click:3000>分配订单</el-button>
						</div>

						<el-form :model="form" ref="ruleForm" label-width="120px"  v-if='!formProcess'>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="专利名称：" v-if="/^(1|2|3|4|7)$/.test(role_id)">{{ form.patent_name }}</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="专利类型：" v-if="/^(1|2|3|4|7)$/.test(role_id)">{{ form.type }}</el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="订单编号：" v-if="/^(1|2|3|4|7)$/.test(role_id)">{{form.order_number}}</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="订单状态：" v-if="/^(1|2|3|4|7)$/.test(role_id)"><font :color='form.status == "已撤案" ? "red" : "green"'>{{ form.status }}</font></el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="form.is_distribution != 3 ? 24 : 12">
									<el-form-item label="联络人：" v-if="/^(2)$/.test(role_id)">{{ form.liaisons }}</el-form-item>
								</el-col>
								<el-col :span="12" v-if="/^(2)$/.test(role_id) && form.is_distribution == 3">
									<el-form-item label='缴费状态：'><span :class="form.order_pay ? 'font_success' : 'font_danger'">{{form.order_pay | orderPay}}</span></el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="专利权人：" v-if="/^(1|3|4|7)$/.test(role_id)">{{ form.patent_user }}</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="发明人姓名：" v-if="/^(1|3|4|7)$/.test(role_id)">
										<span>{{form.user_name}}</span>
									</el-form-item>
								</el-col>
							</el-row>

							<el-row v-if="role_id !=2">
								<el-col :span="12">
									<el-form-item label="身份证号：" v-if="/^(1|3|4|7)$/.test(role_id)">{{ form.id_card }}</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="联络人：" v-if="/^(1|3|4|7)$/.test(role_id)">{{ form.liaisons }}</el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="联络人邮箱：" v-if="/^(1|2|3|4|7)$/.test(role_id)">{{ form.liaisons_email }}</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="联络人电话：" v-if="/^(1|2|3|4|7)$/.test(role_id)">{{ form.liaisons_tel }}</el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="代理人：" v-if="/^(1|3|4|3|7)$/.test(role_id)">
										<strong v-if='isUpdate'>
											<font v-if="form.agent" :color="form.agent.type =='离职'?'red':'green'">{{ agentNumAddName(form.agent) }}</font>
											<!-- <font v-if="!form.agent">{{ form.agent?form.agent.name:'' }}</font> -->
										</strong>
										<p v-else v-for="(item,index) in getUpdateAgent" :key='index'>
											<!-- {{ item.review }} -->
											<span class="agentName oldAgent"> {{ `${item.review.old}（${item.review.old_num}）` }} </span><span class="agentSeparated">-→</span><span class="agentName green"> {{ `${item.review.new}（${item.review.new_num}）` }} </span>
										</p>
									</el-form-item>
									<el-form-item label="代理人：" v-if="/^(2)$/.test(role_id)">
										<strong >
											<font v-if="form.agent" :color="form.agent.type =='离职'?'red':'green'">{{ agentNumAddName(form.agent) }}</font>
											<!-- <font v-if="!form.agent">{{ form.agent?form.agent.name:'' }}</font> -->
										</strong>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="流程人员：">
										<!-- <font color='green'>{{order_process.email_work.split("@")[0].split("followup")[1]}}</font> -->
										<font color='green' v-if="role_id == 2">{{ form.process ? form.process.email_work.split("@")[0].split("followup")[1] + '号' : '' }}</font>
										<font color='green' v-else>{{ form.process ? form.process.name : '' }}</font>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="24" v-if="/^(1|3|4|7)$/.test(role_id)">
									<el-form-item label='缴费状态：'><span :class="form.order_pay ? 'font_success' : 'font_danger'">{{form.order_pay | orderPay}}</span></el-form-item>
								</el-col>
							</el-row>
							<el-form-item label="技术领域：" v-if="/^(1|2|3|4|7)$/.test(role_id) && !formProcess">{{ form.territory }}</el-form-item><!-- v-if="form.territory != null" -->
							<el-form-item label="技术背景：" v-if="/^(1|2|3|4|7)$/.test(role_id) && !formProcess">{{ form.background }}</el-form-item><!-- v-if="form.territory != null" -->
							<el-form-item label="技术问题：" v-if="/^(1|2|3|4|7)$/.test(role_id) && !formProcess">{{ form.problem }}</el-form-item><!-- v-if="form.territory != null" -->
							<el-form-item label="技术方案：" v-if="/^(1|2|3|4|7)$/.test(role_id) && !formProcess">{{ form.plan }}</el-form-item>
							<el-form-item label="项目优势：" v-if="/^(1|2|3|4|7)$/.test(role_id) && !formProcess">{{ form.advantage }}</el-form-item>
							<el-form-item label="具体实施方式：" v-if="/^(1|2|3|4|7)$/.test(role_id) ">{{ form.way }}</el-form-item>
							<el-form-item label="撤案原因：" v-if="/^(1|2|3|4|7)$/.test(role_id) && form.status =='已撤案'">
								<font v-if="form && form.update_records" color ='red'>{{ form.update_records ? form.update_records[form.update_records.length-1].review : ''  }}</font>
							</el-form-item>
							<el-form-item label="备注：" v-if="/^(1|2|3|4|7)$/.test(role_id) ">{{ form.remarks }}</el-form-item>

							<!-- label="资料下载：" -->
							<template v-if='!formProcess'>
								<el-row v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<el-col :span="12">
										<el-form-item label="附图：" style="border-bottom-width: 1px;">
											<div v-if="form.img != '' || form.img != null" class="preview-img-wrap">
												<pre-img
													:smallImg="form.imgList"
													:bigImg="form.imgList2"
													class="pre-img">
												</pre-img>

											</div>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="附件：" style="border-bottom-width: 1px;">
											<div  v-if="form.file != '' || form.file != null" style="height: 40px;-webkit-display:flex;
													display:flex;
													-webkit-align-items:center;
													align-items:center;">
												<a v-for="item in form.fileArr" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
											</div>
										</el-form-item>
									</el-col>
								</el-row>
							</template>
							<template v-if='!formProcess && student_upload'>
								<el-row v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<el-col :span="24">
										<el-form-item label="导师审核文件：" style="border-bottom-width: 1px;">
											<div  v-if="form.student_review_file != '' || form.student_review_file != null" style="height: 40px;-webkit-display:flex;
													display:flex;
													-webkit-align-items:center;
													align-items:center;">
												<a v-for="item in form.studentFile" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
											</div>
										</el-form-item>
									</el-col>
								</el-row>
							</template>

							<!-- 撤案申请理由 -->
							<template v-if="form.reason && status == '处理中'">
								<el-row>
									<el-col :span="12">
										<el-form-item label="撤案申请理由：" style="border-bottom-width: 1px;">
											<span class="unfinish">{{form.reason}}</span>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="撤案对比文件：" style="border-bottom-width: 1px;">
											<div  v-if="form.reason_file != '' || form.reason_file != null" style="height: 40px;-webkit-display:flex;
													display:flex;
													-webkit-align-items:center;
													align-items:center;">
												<a v-for="item in form.reasonfileArr" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
											</div>
										</el-form-item>
									</el-col>
								</el-row>
							</template>


							<div v-if="(role_id == 2 || role_id == 4 || role_id == 7) && !form.reason ">

								<!-- ((form.student_id && $store.state.user.is_teacher == 2) || -->
										<!-- (!form.student_id && $store.state.user.is_teacher == 2 && form.agent.id == $store.state.user.id))"> -->

								<el-form-item label="内容审核文件："
									v-if="(form.status == '代理人撰写中' || form.status == '案件修改中')
										&& role_id == 2 && !student_upload && teacher_upload">

									<div class="upload-demo" style="margin-top: 0px;">
										<span class="tips_1">请直接上传已完成的word文档,单个主体文件,无需分解,仅供内容 审查</span>
										<br />
										<span class="tips_2">* 如果多报或者分案或返修等,请分别上传word文件</span>
										<br />
										<template v-if="form.status == '代理人撰写中'">
											<span class="tips_3">* 多报文件命名格式: 订单编号-代理人姓名-案件名称-案件类型.docx</span>
											<br />
											<span class="tips_3">* 分案文件格式为：订单编号-序号(数字)-代理人姓名-案件名称-案件类型.docx</span>
										</template>
										<template v-if="form.status == '案件修改中'">
											<span class="tips_3">* 多报返修文件格式为：订单编号-代理人姓名-案件名称-案件类型-R(数字).docx</span>
											<br />
											<span class="tips_3">* 分案返修文件格式为：订单编号-序号(数字)-代理人姓名-案件名称-案件类型-R(数字).docx</span>
										</template>
										<br />
										<span class="tips_2">* 免审文件内容要求：
											<el-tooltip placement="top" effect="light">
												<div slot="content" style="line-height: 20px" class="c333">
													实用新型：Word文件内容必须大于<span class="unfinish">12页</span>，<span class="unfinish">4号宋体</span>，<span class="unfinish">1.5倍间距</span>，说明书附图最少<span class="unfinish">2张</span><br />
													发明专利：Word文件内容必须大于<span class="unfinish">18页</span>，<span class="unfinish">4号宋体</span>，<span class="unfinish">1.5倍间距</span>，说明书附图最少<span class="unfinish">4张</span><br />
													免审文件，如果文件内容格式有错误<span class="unfinish">双倍处罚</span>。
												</div>
												<i class="el-icon-question f16 ml5 c333" style="vertical-align: -1px"></i>
											</el-tooltip>
										</span>
									</div>

									<!-- 上传控件 -->
									<div class="upload-wrap">
										<el-upload
											v-if="form.status == '代理人撰写中' || form.status == '案件修改中'"
											class="upload-demo"
											style="margin-top: 0px;"
											ref="upload"
											:auto-upload="true"
											:on-change="handleChange"
											:action="baseUrl + '/api/order/'+ this.form.id +'/upload'"
											:file-list="fileList"
											:http-request="uploadSectionFile"
											:on-remove="handleRemove"
											multiple
											:limit="5">
											<!-- <div slot="tip" class="el-upload__tip">上传文件</div> -->
											<div class="upload-demo-btns">
												<el-button slot="trigger" size="small" type="primary">选择文件</el-button>
											</div>
										</el-upload>
										<div class="free-btn" v-if="form.status == '代理人撰写中' || form.status == '案件修改中'">
											<el-dropdown trigger="click" placement="bottom" class="free-drop">
												<el-button type="success" size="small">案件上传</el-button>
												<el-dropdown-menu slot="dropdown" class="free-drop-menu">
													<el-dropdown-item class="mb10">
														<el-button size="small" type="primary" class="normal-btn" @click="submitUpload(false)" v-no-more-click:3000>普通案件</el-button>
													</el-dropdown-item>
													<el-dropdown-item>
														<el-button
														v-if="$store.state.user.is_teacher != 2"
															:disabled="$store.state.user.trial_free != 1 || !student_finish"
															size="small"
															type="danger"
															class="normal-btn"
															@click="submitUpload(true)"
															v-no-more-click:3000>
															免审案件
														</el-button>
													</el-dropdown-item>
												</el-dropdown-menu>
											</el-dropdown>

										</div>
										<!-- <div class="free-wrap" v-if="$store.state.user.trial_free == 1 && fileListV.length > 0">
											<div class="unfinish" style="height: 40px">
											</div>
											<div class="checkbox-wrap">
												<el-checkbox-group
													v-model="free_files"
												>
													<div v-for="(item, index) in fileListV" :key="index" class="checkbox-line">
														<el-checkbox
															:label="item"
														>若您不希望提交免审文件则不勾选</el-checkbox>
														<span class="finish"></span>
													</div>
												</el-checkbox-group>
											</div>
										</div> -->
									</div>
								</el-form-item>

								<!-- 内审中 不显示上传按钮，显示文件   修改中显示上传文件 并可上传-->
								<el-form-item  label="内容审查文件：" v-if="form.status == '案件内审中' || role_id == 4 || role_id == 7" class="file_content1 review_file" >
									<a v-for="item in form.reviewfileArr" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
										:download="item.path" :title="item.path" :class="['el-icon-tickets file_sh', {'free-file': item.path.indexOf('免审') > -1}]"></a>
								</el-form-item>
							</div>

							<!-- 审核员一直只能查看 -->
							<div v-if='!formProcess'>
								<!-- <el-row v-if="/^(1|7)$/.test(role_id)"> -->
									<!-- <el-col :span="12"> -->
										<el-form-item  v-if="/^(1|7)$/.test(role_id)" label="审核文件：" class="file_content1 file" style="border-bottom-width: 1px;">
											<a v-for="item in form.reviewfileArr"
												:key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path"
												:title="item.path"
												class="el-icon-tickets file_sh">
											</a>
										</el-form-item>
									<!-- </el-col> -->
									<!-- <el-col :span="12">
										<el-form-item label="完成文件：" class="file_content1 file" style="border-bottom-width: 1px;">
											<a v-for="item in form.fishfileArr" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
											 :download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
										</el-form-item>
									</el-col> -->

								<!-- </el-row> -->
								<!-- <el-form-item label="完成文件：" class="file_content1" v-if="/^(4|7)$/.test(role_id)">
									<a v-for="item in form.fishfileArr" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
									 :download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
								</el-form-item> -->
							</div>

							<!-- 上报文件上传中可以看到用户评分 -->
							<template v-if="form.status == '上报文件上传中'">
								<el-row v-if="form.grades">
									<el-col :span="12">
										<el-form-item label="服务态度：" style="border-bottom-width: 1px;" class="flex-form">
											<el-rate
												disabled
												class="agetn-rate"
												show-score
												allow-half
												:value="Number(form.grades.attitude)">
											</el-rate>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="撰写质量：" style="border-bottom-width: 1px;" class="flex-form">
											<el-rate
												disabled
												show-score
												class="agetn-rate"
												allow-half
												:value="Number(form.grades.quelity)">
											</el-rate>
										</el-form-item>
									</el-col>
								</el-row>
								<el-row v-if="form.grades">
									<el-col :span="24">
										<el-form-item label="撰写耗时：" style="border-bottom-width: 1px;" class="flex-form">
											<el-rate
												disabled
												show-score
												allow-half
												class="agetn-rate"
												:value="Number(form.grades.take_time)">
											</el-rate>
										</el-form-item>
									</el-col>
								</el-row>
								<el-row v-if="form.grades">
									<el-col :span="24">
										<el-form-item label="用户评价：" style="border-bottom-width: 1px;">
											{{form.grades.remark}}
										</el-form-item>
									</el-col>
								</el-row>
							</template>

						</el-form>
						<!-- 国知局后查看订单列表 -->
						<el-form :model="form" ref="ruleForm" label-width="120px"  v-else>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="专利名称：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
										<span >{{ form.name }}</span>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="专利类型：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
										<span >{{ form.type == 'F' ? '发明专利' : (form.type == 'S' ? '实用新型' : '外观设计') }}</span>
									</el-form-item>
								</el-col>
							</el-row>

							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="订单编号：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<span >{{form.order_number}}</span>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="订单状态：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<font :color='form.status == "撤案" ? "red" : "green"'>{{ form.status }}</font>
									</el-form-item>
								</el-col>
							</el-row>

							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="申请号：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<span >{{ form.application_number }}</span>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="申请机构：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<span >{{ form.organization }}</span>
									</el-form-item>
								</el-col>
							</el-row>

							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="专利权人：" v-if="/^(1|3|4|7)$/.test(role_id)">
									<span v-if="form.order">{{ form.order.patent_user }}</span>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="发明人姓名：" v-if="/^(1|3|4|7)$/.test(role_id)">
										<span v-if="form.order">{{ form.order.user_name }}</span>
									</el-form-item>
								</el-col>
							</el-row>

							<el-row v-if="role_id !=2">
								<el-col :span="12">
									<el-form-item label="身份证号：" v-if="/^(1|3|4|7)$/.test(role_id)">
										<span v-if="form.order">{{ form.order.id_card }}</span>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="联络人：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
										<span v-if="form.order">{{ form.order.liaisons }}</span>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="联络人邮箱：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<span v-if="form.order">{{ form.order.liaisons_email }}</span>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="联络人电话：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
									<span v-if="form.order">{{ form.order.liaisons_tel }}</span>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row type="flex">
								<el-col :span="12">
									<el-form-item label="代理人：" v-if="/^(1|2|3|4|7)$/.test(role_id)">
										<!-- <strong >
											<template v-if="order_agent">
												<font v-if="order_agent" :color="order_agent.type =='离职'?'red':'green'">{{ agentNumAddName(order_agent) }}</font>
											</template>
										</strong> -->
										<!-- {{ getUpdateAgentforProcess[0].operation_record.old_agent }} -->
										<strong v-if='isUpdateAgent'>
											<font v-if="order_agent" :color="order_agent.type =='离职'?'red':'green'">{{ agentNumAddName(order_agent) }}</font>
										</strong>
										<p v-else v-for="(item,index) in getUpdateAgentforProcess" :key='index'>
											<span class="agentName oldAgent"> {{ `${item.old_agent}（${item.old_num}）` }} </span><span class="agentSeparated">→</span><span class="agentName green"> {{ `${item.new_agent}（${item.new_num}）` }} </span>
										</p>

									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="流程人员：">
										<font color = 'green'>{{order_process.name}}</font>
									</el-form-item>
								</el-col>
							</el-row>
							<el-form-item label="撤案原因：" v-if="form.status =='撤案'">
								<font v-if="form && form.order.update_records" color ='red'>{{ form.order.update_records && form.order.update_records[0] ? form.order.update_records[0].review : ''  }}</font>
							</el-form-item>
							<!-- 国知局后文件下载 -->
							<template >
								<el-row type="flex">
									<el-col :span="12">
										<el-form-item label="受理通知书：">
											<template v-if="orderRow">
												<div v-if="orderRow.acceptance_note_file != '' || orderRow.acceptance_note_file != null" style="height: 40px;-webkit-display:flex;
												display:flex;
												-webkit-align-items:center;
												align-items:center;">
												<a v-for="item in orderRow.acceptanceFiles" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>

												</div>
											</template>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="缴费通知书：">
											<template v-if="orderRow">
												<div v-if="orderRow.demand_note_file != '' || orderRow.demand_note_file != null" style="height: 40px;-webkit-display:flex;
												display:flex;
												-webkit-align-items:center;
												align-items:center;">
												<a v-for="item in orderRow.demandFiles" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
												</div>
											</template>
										</el-form-item>
									</el-col>
								</el-row>
								<el-row type="flex">
									<el-col :span="12">
										<el-form-item label="审查文件：" style="border-bottom-width: 1px;">
											<template v-if="orderRow">
												<div v-if="orderRow.opinion_file != '' || orderRow.opinion_file != null" style="height: 40px;-webkit-display:flex;
												display:flex;
												-webkit-align-items:center;
												align-items:center;">
												<a v-for="item in orderRow.opinionFiles" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
												</div>
											</template>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="答复文件：" style="border-bottom-width: 1px;">
											<template v-if="orderRow">
												<div v-if="orderRow.answer_file != '' || orderRow.answer_file != null" style="height: 40px;-webkit-display:flex;
												display:flex;
												-webkit-align-items:center;
												align-items:center;">
												<a v-for="item in orderRow.answerFiles" :key="item.id" :href="baseUrl + '/api/download?path='  + item.file +'/'+ item.path"
												:download="item.path" :title="item.path" class="el-icon-tickets file_sh"></a>
												</div>
											</template>
										</el-form-item>
									</el-col>
								</el-row>
							</template>
							<el-form-item label="备注：" v-if="/^(1|2|3|4|7)$/.test(role_id) ">
								<span v-if="form.order">{{ form.order.remarks }}</span>
								<span v-else></span>
							</el-form-item>
							<el-form-item label="同日提交案件：" v-if="/^(1|2|3|4|7)$/.test(role_id) ">
								<span v-if="form.order">{{ form.order.same_day_number ? form.order.same_day_number : '无同日提交案件' }}</span>
								<span v-else></span>
							</el-form-item>
							<el-row v-if="form.grades">
								<el-col :span="12">
									<el-form-item label="服务态度：" style="border-bottom-width: 1px;" class="flex-form">
										<el-rate
											disabled
											class="agetn-rate"
											show-score
											allow-half
											:value="Number(form.grades.attitude)">
										</el-rate>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="撰写质量：" style="border-bottom-width: 1px;" class="flex-form">
										<el-rate
											disabled
											show-score
											class="agetn-rate"
											allow-half
											:value="Number(form.grades.quelity)">
										</el-rate>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row v-if="form.grades">
								<el-col :span="24">
									<el-form-item label="撰写耗时：" style="border-bottom-width: 1px;" class="flex-form">
										<el-rate
											disabled
											show-score
											allow-half
											class="agetn-rate"
											:value="Number(form.grades.take_time)">
										</el-rate>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row v-if="form.grades">
								<el-col :span="24">
									<el-form-item label="用户评价：" style="border-bottom-width: 1px;">
										{{form.grades.remark}}
									</el-form-item>
								</el-col>
							</el-row>
						</el-form>
						<div v-if='showAnswer' class="uploadAnswer">
							<el-select  v-model="isAnswer" placeholder="请选择上传文件" size="small" class="uploadSelect">
								<el-option 
									v-for="(item, index) in answerOptions" 
									:key='index'
									:label="item.label"
									:value="item.value"
									:disabled="getAnswerDisabled(item)">
								</el-option>
								<!-- <el-option label="上传审查文件" value="1" ></el-option> -->
								<!-- <el-option label="上传补正文件" value="2" ></el-option>
								<el-option label="上传初审文件" value="3" :disabled="isupdateAgent"></el-option>
								<el-option label="上传实审文件" value="4" :disabled="isupdateAgent"></el-option>
								<el-option label="上传驳回文件" value="5" :disabled="isupdateAgent"></el-option>
								<el-option label="上传授权文件" value="6" :disabled="isupdateAgent"></el-option>
								<el-option label="上传证书文件" value="7" :disabled="isupdateAgent"></el-option>  -->
							</el-select>
							<el-checkbox  v-if='showCheckbox' v-model="isupdateAgent">变更代理人</el-checkbox>

							<div class="inlineblock">
								<el-upload
									ref="uploadAnswer"
									:action='iploadULR'
									:auto-upload="false"
									:on-change ='handleChange1'
									:http-request="uploadSectionFile"
									multiple
									:limit="uploadLimit"
									:file-list="fileList">
									<el-button size="mini" type="primary">{{ `选择${selectBtnText}` }}</el-button>
									<el-button style="margin-left: 10px;" size="mini" type="success" @click.stop="submitAnswer()"  v-no-more-click:3000>{{ `上传${selectBtnText}` }}</el-button>
								</el-upload>
							</div>
						</div>

						<!-- <el-button  class="order_taking" type="danger" @click="orderTaking" v-no-more-click:3000>接单</el-button> -->
						<div v-if="status == '待接单' && role_id == 2" class="orderTaking">
							<el-popover
								v-if='$store.state.user.is_teacher == 1'
								placement="left"
								width="120"
								trigger="click">
								<el-button v-no-more-click:3000 type="danger" size="small" @click.stop="orderTaking">自己接单</el-button>
								<br/>
								<el-button v-no-more-click:3000 type="warning" class='mt10' size="small" @click.stop="distributeOrder(form)">分配订单</el-button>
								<el-button slot="reference" type="danger" >接单</el-button>
							</el-popover>
							<el-button v-else v-no-more-click:3000  type="danger" size="small" @click.stop="orderTaking">接单</el-button>
						</div>
					</div>
				</el-col>
				<el-col :span="1">
					<br />
				</el-col>
				<!-- 右侧审批意见 + 流程进度 -->
				<el-col :span="7" v-if='!formPendingDisposal && !formProcess'>
					<div class="grid-content bg-purple r-approval">
						<el-tabs v-model="activeName" @tab-click="handleClick">
							<el-tab-pane label="审批意见" name="first">
								<p v-if="!form.allOpinions">暂无审批意见</p>
								<div v-else class= 'quickReply'>
									<el-timeline>
										<el-timeline-item
											v-for="(item, index) in form.allOpinions"
											:key="index"
											:timestamp="item.created_at"
										>
											<el-card class="messagebox">
												<Tooltip content="点我回复" class="fr" v-if="$store.state.user.role_id == 2 && (form.status == '案件修改中' || form.status == '代理人撰写中') ">
													<i class="el-icon-chat-dot-round leaveWord ml5" @click="showTextarea(item, index)"></i>
												</Tooltip>
												<div class="agent_item clearfloat" v-if="item.type == 6">
													<span class="item_user fr">代理人</span>
													<span class="item_time fr">{{item.created_at}}</span>
													<div class="item_message messageBackground_r fr">
														<span>{{item.review_cn}}</span>
													</div>
												</div>
												<div v-else class="item">
													<span class="item_time">{{item.created_at}}</span>
													<span class="item_user">{{item.from}}</span>
													<div class="item_message messageBackground_l">
														<span>{{item.review_cn}}</span>
													</div>
													<div class="deduction_message messageBackground_l" v-if="item.deduction_reason != ''">
														<div>
															<span>扣款原因：</span>
															<span class="ml10 font_danger">{{item.deduction_reason}}</span>
														</div>
														<div>
															<span>扣款金额：</span>
															<span class="ml10 font_danger">{{item.money_cn}}</span>
														</div>
													</div>
												</div>

												<div v-for="(agent, index2) in item.agent_message" :key="index2">
													<div class="agent_item clearfloat" v-if="agent.role_id == '2'">
														<span class="item_user fr">代理人</span>
														<span class="item_time fr">{{agent.created_at}}</span>
														<div class="item_message messageBackground_r fr">
															<span>{{agent.review_cn}}</span>
														</div>
													</div>
													<div v-else class="item">
														<span class="item_time">{{agent.created_at}}</span>
														<span class="item_user">审核员</span>
														<div class="item_message messageBackground_l">
															<span>{{agent.review_cn}}</span>
														</div>
													</div>
												</div>
												<div v-if="item.show_input" class="clearfloat mt20">
													<el-input type="textarea" :rows="4" placeholder="请输入内容" v-model="replyMessage"></el-input>
													<el-button class="fr mt10" type="primary" @click="submitMessage(item)">发送</el-button>
													<!-- <el-button class="fr mt10 mr10" @click="resets ">重置</el-button> -->
												</div>
											</el-card>
										</el-timeline-item>
									</el-timeline>
								</div>

								<!-- <el-steps direction="vertical" v-else >
									<el-step class="item_tab" v-for="(item, index) in form.allOpinions" :key="index">
										<template slot="icon">
											<span> <font class="step-icon_user"> {{ item.review_user[0] }}</font> </span>
										</template>
										<template slot="title">
											<div class="clearfloat">
												<span class="fl msg-user">
													<font class="step-title_user">
														{{ item.review_user }}
														<span v-if="item.type == 6">（审查文件撤回）</span>
														<span v-else>{{item.from}}</span>
													</font> {{ item.created_at }}</span>
												<Tooltip content="点我回复" class="fr" v-if="$store.state.user.role_id == 2 && (form.status == '案件修改中' || form.status == '代理人撰写中') && item.type != 6">
													<i class="el-icon-chat-dot-round leaveWord ml5" @click="agentAnwser(item)"></i>
												</Tooltip>
											</div>
										</template>
										<template slot="description">
											<div class="agent-msg-wrap">
												<div class="agent-msg">
													<span class="title">{{item.type == 6 ? '撤回原因' : '审核意见'}}：</span>
													<span class="content">
														<span class="clim">
															<span v-if="item.review.indexOf('&&&') == -1">{{item.review}}</span>
															<span v-else>
																{{item.review.split('&&&')[0]}}
																<br />扣款金额：
																<span class="unfinish">{{item.review.split('&&&')[1].split('###')[0]}}元</span>
																<br />扣款原因：
																<span class="unfinish">{{item.review.split('###')[1]}}</span>
															</span>
														</span>
													</span>
												</div>
											</div>
											<div v-if="item.agent_message && item.agent_message.length > 0" class="back-msg">
												<div v-for="(msg, index) in item.agent_message" :key="index" class="agent-msg-wrap">
													<div class="agent-msg-title msg-user">
														<font class="msg-name" style="color: green" v-if="msg.review_user.indexOf('&&&审核员留言') > -1">{{ msg.review_user.split('&&&')[0] }}(审核员)</font>
														<font class="msg-name" v-else-if="msg.review_user.indexOf('&&&学生留言') > -1">{{ msg.review_user.split('&&&')[0] }}</font>
														<font class="msg-name" style="color: green" v-else-if="msg.review_user.indexOf('&&&老师留言') > -1">{{ msg.review_user.split('&&&')[0] }}(导师)</font>
														<font class="msg-name" v-else>{{ msg.review_user }}</font>
														{{ msg.created_at }}
													</div>
													<div class="agent-msg">
														<span class="title">回复内容：</span>
														<span class="content">
															<span class="clim">{{msg.review}}</span>
														</span>
													</div>
												</div>
											</div>
										</template>
									</el-step>
								</el-steps> -->
							</el-tab-pane>

							<el-tab-pane v-if="/^(1|3|4|7)$/.test(role_id)" label="案件修改记录" name="update">
								<div class="block">
									<p v-if="!form.update_records">暂无案件修改记录"</p>
									<el-timeline v-else v-for="(item,index) in getUpdateRecords" :key="index">
										<el-timeline-item :timestamp="item.created_at" placement="top">
											<el-card v-if='item.isObject'>
												<p class="fontgreen"> {{ `${item.review_user}：` }} </p>
												<p style="padding-left: 10px">
													{{ item.review }}
												</p>
											</el-card>
											<el-card v-else>
												<p class="fontgreen"> {{ `${item.review_user}：` }} </p>
												<p style="padding-left: 10px">
													<!-- `${item.review.old}（${item.review.old_num}）` -->
													代理人由 <span class="fontgreen">{{`${item.review.old}（${item.review.old_num}）`}}</span> 变更为 <span class="fontgreen">{{`${item.review.new}（${item.review.new_num}）`}}</span>，
													变更理由：<span class="fontgreen">{{item.review.reason}}</span>
												</p>
											</el-card>
										</el-timeline-item>
									</el-timeline>
								</div>
							</el-tab-pane>

							<el-tab-pane label="流程进度" name="second">
								<div class="block">
									<el-timeline v-for="(item,index) in form.statuss" :key="index">
										<el-timeline-item :timestamp="item.pivot.created_at +'  '+item.operation" placement="top">
											<el-card>
												<h4>{{item.name}}</h4>
												<p v-if="item.id == 1">
													发明人：<span class="fontgreen">{{ form.liaisons }}</span>  提交
												</p>
												<p v-if="item.id == 2">
													代理人：<span class="fontgreen">{{ agentNumAddName(form.agent) }}</span> 接单
												</p>
												<p v-if="item.id == 3">
													代理人：<span class="fontgreen">{{ agentNumAddName(form.agent) }}</span> 提交审核文件
												</p>
												<p v-if="item.id == 4">
													审核员：<span class="fontgreen">{{form.auditor_name}}</span> 审核
												</p>
												<p v-if="item.id == 5">
													审核员：<span class="fontgreen">{{form.auditor_name}}</span> 审核
												</p>
												<p v-if="item.id == 7">
													代理人：<span class="fontgreen"> {{ agentNumAddName(form.agent) }}</span>
													提交
												</p>
													<!-- <template v-if="role_id== 2">
														{{form.agent?form.agent.name: ""}}
													</template> -->
													<!-- <template v-else>
														{{form.agent?form.agent.name:""}}
													</template> -->

												<p v-if="item.id == 13">联络人：<span class="fontgreen">{{form.liaisons}}</span> 提交</p>
												<p v-if="index*1<form.statuss.length-1">处理耗时：{{intervalTime(form.statuss[index*1+1].pivot.created_at,form.statuss[index*1].pivot.created_at)}}</p>
											</el-card>
										</el-timeline-item>
									</el-timeline>
								</div>
							</el-tab-pane>
						</el-tabs>
					</div>
				</el-col>
			</el-row>

			<!--  未接单查看里可分配代理人 内层嵌套分配代理人 -->
			<el-dialog title="分配代理人" :visible.sync="dialogFP" append-to-body center>
				<el-form :model="formAgent" :rules="rulesFP" ref="ruleFormFP" v-if="dialogFP">
					<el-form-item label="选择代理人" prop="name">
						<!-- <el-autocomplete
							v-model="formAgent.name"
							:fetch-suggestions="querySearch"
							:trigger-on-focus="true"
							placeholder="选择代理人"
							@select="handleSelect">
						</el-autocomplete> -->
						<el-select v-model="formAgent.name" @change='changeAgentFP'  filterable placeholder="请选择代理人">
              <el-option
                v-for="(item, index) in agentData"
                :key="index"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="handleCloseFP" v-no-more-click:3000>取 消</el-button>
					<el-button type="primary" @click="submitFormFP('ruleFormFP')" v-no-more-click:3000>确 定</el-button>
				</div>
			</el-dialog>

			<!-- 上传审核文件 代理人离职 重新选择代理人 -->
			<el-dialog title="请重新分配代理人" :visible.sync="reselectAgent" center append-to-body >
				<el-form :model="formAgent" :rules="rulesAgent" ref="changeAgentForm" label-width="140px">
					<el-form-item label="选择代理人：" prop="name">
						<!-- <el-autocomplete
							v-model="formAgent.name"
							:fetch-suggestions="querySearch"
							:trigger-on-focus="true"
							placeholder="选择代理人"
							@select="handleSelect">
						</el-autocomplete> -->
						<el-select v-model="formAgent.name"  filterable placeholder="请选择代理人">
              <el-option
                v-for="(item, index) in agentData"
                :key="index"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<!-- <el-button @click="handleCloseAgent">取 消</el-button> -->
					<el-button type="primary" @click="reselectUpload('changeAgentForm')" v-no-more-click:3000>确 定</el-button>
				</div>
			</el-dialog>
		</el-dialog>
		<sure-pay ref="sure-pay" @closeDialog="closeDialog" @refresh="refresh"></sure-pay>
		<edit-order ref="edit-order" @refresh="refresh"></edit-order>
		<endProcess ref="endProcess" @refresh="refresh"></endProcess>
		<!-- 流程更新数据 -->
		<updateDialog ref="updateDialog" @refresh="refresh"></updateDialog>

		<!-- 订单撤销 -->
		<order-rescind ref="order-rescind" @rescind="rescind"></order-rescind>

		<file-recind ref="file-recind" @refresh="changeFile"></file-recind>

		<!-- 代理人回复 -->
		<agent-anwser ref="agent-anwser" @refresh="refreshData"></agent-anwser>

		<!-- 补充订单 -->
		<supplementOrder ref="supplementOrder" @refresh="refreshData"/>

		<!-- 更新状态 -->
		<updateOrderStatusDialog ref='updateOrderStatusDialog'></updateOrderStatusDialog>
		<!-- 国知局后修改代理人 -->
		<editAgentDialog ref='editAgentDialog' @refresh="refresh"></editAgentDialog>
		<!-- 国知局前修改代理人 -->
		<orderEditAgent ref='orderEditAgent' @refresh='refreshData'></orderEditAgent>

		<!-- 代理人撤回上报文件 -->
		<withdrawCompleteFile ref='withdrawCompleteFile' @refresh='refresh'></withdrawCompleteFile>

		<!-- 导师分配代理人 -->
		<distributeOrder ref='distributeOrder' @refresh='refresh'></distributeOrder>

		<!-- 生成CPC文件 -->
		<cpcForm ref="cpcForm" @refresh='refresh'></cpcForm>
	</div>
</template>
<script>
	import surePay from './surePay'
	import {
		getOrderInfo,
		closeOrder,
		uploadSH,
		delOrder
	} from "~/api/order"; //结束流程
	import {intervalTime} from '~/util'
	import Watermark from '~/util/watermark'
	import {
		orderChangeAgent,
		getAgent,
		orderAgent
	} from "~/api/agent"; //更改代理人
	import orderJS from "./orderJS";

	// 方法的JS文件
	import orderFn from "../getOrderList";

	import editOrder from './edit-order'
	import endProcess from './endProcess'
	import updateDialog from './updateInProcessing' // 流程更新数据弹出框
	import supplementOrder from './supplementOrder' // 补充订单
	import updateOrderStatusDialog from './updateOrderStatus'	// 更新状态
	import editAgentDialog from './editAgentDialog'	// 国知局后修改代理人
	import orderEditAgent from './order-editAgent'	// 国知局前修改代理人
	import distributeOrder from './distributeOrder'

	import axios from "axios";

	import orderRescind from './order-rescind'
	import fileRecind from './file-recind'
	import agentAnwser from './agent-anwser'
	import preImg from '~/components/pre-img'

	import withdrawCompleteFile from './withdrawCompleteFile'

	import cpcForm from './cpc-form'
	export default {
		components: {
			surePay,
			editOrder,
			endProcess, // 结束流程弹窗
			updateDialog,
			orderRescind,
			agentAnwser,
			supplementOrder,
			updateOrderStatusDialog,
			preImg,
			editAgentDialog,
			orderEditAgent,
			fileRecind,
			withdrawCompleteFile,
			distributeOrder,
			cpcForm
		},
		props: ['order_process', 'order_agent', 'formProcess', 'orderRow', 'formPendingDisposal', 'stepsText'],
		data() {
			return {
				student_finish: false,
				student_upload: false,
				steps_text: this.stepsText,
				free_files: [],
				show_process: false,
				opDateMax: 1, //状态里最大的id是多少
				showOP: true,
				dialogVisible: false,
				innerVisible: false,
				reselectAgent: false,
				dialogFP: false,
				activeName: "first",
				status: "",
				formLen: 0,
				activeNum: 1,
				agentData: [],
				form: {},
				formAgent: {},
				rulesAgent: {
					name: [{
						required: true,
						message: "请选择代理人",
						trigger: "change"
					}],
					reason: [{
						required: true,
						message: "请填写修改原因",
						trigger: "blur"
					}]
				},
				rulesFP: {
					name: [{
						required: true,
						message: "请选择代理人",
						trigger: "blur"
					}]
				},
				restaurants: [],
				baseUrl: global.baseurl,
				role_id: 1,
				isupdateAgent: false,
				//图片
				imgArr: [],
				//文件
				fileArr: [],

				// 上传文件
				fileList: [],
				// 样式
				myWidth: "95%",
				left_form: 16,
				fileListV:[],
				endProcessReason: '',
				js_lookOrder_DOM: '',
				divDOM : '',
				iploadULR: '',
				finals: '',
				isAnswer: null,
				isUpdate: true, // 国知局前变更代理人
				isUpdateAgent: true, // 国知局后变更代理人
				step_status: 'success',
				selectAgentFP: null,
				replyMessage: '',
				uploadLimit: 2,
				answerOptions: [
					{
						label: '上传审查文件',
						value: '1'
					},
					{
						label: '上传补正文件',
						value: '2'
					},
					{
						label: '上传初审文件',
						value: '3'
					},
					{
						label: '上传实审文件',
						value: '4'
					},
					{
						label: '上传驳回文件',
						value: '5'
					},
					{
						label: '上传授权文件',
						value: '6'
					},
					{
						label: '上传证书文件',
						value: '7'
					},
				]
				// selectBtnText: ''
			}
		},
		computed :{

			sumDate() {
				let start = new Date(),
					now = new Date()
				if (Object.keys(this.form).length > 0) {
					start = this.form.pick_up_date ? this.form.pick_up_date : this.form.created_at
				}
				return intervalTime(start, now, true).split('天')[0]
			},
			setLeft_form () {
				if (this.formProcess || this.formPendingDisposal) {
					return 24
				} else {
					return 16
				}
			},
			selectBtnText () {
				console.log(this.isAnswer)
				switch (this.isAnswer) {
					case '1':
						return '审查意见'
						break;
					case '2':
						return '补正文件'
						break;
					case '3':
						return '初审文件'
						break;
					case '4':
						return '实审文件'
						break;
					case '5':
						return '驳回文件'
						break;
					case '6':
						return '授权文件'
						break;
					case '7':
						return '证书文件'
						break;
					default:
						return '文件'
						break;
				}
			},
			getUpdateRecords () {
				let update_records = this.form.update_records
				if (update_records) {
					for (let i = 0; i < update_records.length; i++ ) {
						if (update_records[i].review[0] !== '{') {
							update_records[i].isObject = true
						} else {
							update_records[i].isObject = false
							update_records[i].review = JSON.parse(update_records[i].review)
						}
					}
				}
				return update_records
			},
			getUpdateAgent () {
				let updateAgent = []
				if (this.form.update_records) {
					for (let i = 0; i < this.form.update_records.length; i++ ) {
						if (this.form.update_records[i].review instanceof Object) {
							updateAgent.push(this.form.update_records[i])
						}
					}
				}
				return updateAgent
			},
			getUpdateAgentforProcess () {
				let updateAgent = []
				if (this.form.change_agent_operation) {
					for (let i = 0; i < this.form.change_agent_operation.length; i++ ) {
						// if (this.form.change_agent_operation[i].review instanceof Object) {
							updateAgent.push(JSON.parse(this.form.change_agent_operation[i].operation_record))
						// }
					}
				}
				return updateAgent
			},
			showAnswer () {
				if ((this.role_id == 4 || this.role_id == 7) 
						&& this.formProcess 
						&& (this.orderRow.status != "等待提交国知局"
						&& this.orderRow.status != "撤案" 
						&& this.orderRow.status != "下证"
						&& this.orderRow.status != "驳回")
						) {
					return true
				} else {
					return false
				}
			},
			showCheckbox () {
				if (this.isAnswer == '1' || this.isAnswer == '2') {
					return true
				} else {
					return false
				}
			},
			teacher_upload () {
				if (this.form) {
					let sta = this.form.statuss
					let teacher = this.$store.state.user.is_teacher

					if (teacher == 1) {
						// 如果是导师分配案件 并且 是发明人退回的案件 导师就可以上传撰写文件
						if (!this.form.student_id) { // 自己的案件
							return true
						} else { // 分配案件
							// 判断是不是退回
							if (this.form.student_id != '' && sta[0].id == 15) {
								return true
							} else {
								return false
							}
						}

					} else if (teacher == 2) {
						// 如果是导师分配案件 并且 是审核员驳回的案件则徒弟不能撰写
						if (this.form.student_id != '' && (sta[0].id == 5 || sta[0].id == 15)) {
							return false
						} else {
							return true
						}
					}
				}
				return true
			},
			canAllocationOrder () {
				if (this.form) {
					if (this.form.student_id) {
						return true
					} else {
						return false
					}
				} else {
					return false
				}
			},
			// 判断案件是否完结
			isUpdateFileDis () {
				// if (this.orderRow.status != "驳回") {

				// }
			},

		},
		created () {
		},
		methods: {
			createCPC (data) {
				this.$refs['cpcForm'].show(data)
			},
			getAnswerDisabled(item) {
				// if (item.label == '上传审查文件' || item.label == '上传补正文件' ) {
				// 	return false
				// }
				if ((this.form.status == '授权' && item.label != '上传证书文件') || this.isupdateAgent) {
					return true
				}
			},
			// 导师分配代理人
			distributeOrder(data) {
				this.$refs['distributeOrder'].show(data)
			},
			withdrawDisabled(data) {
				if (data.order && data.order.fish_file) {
					return false
				} else {
					return true
				}
			},
			withdrawCompleteFile(data) {
				this.$refs['withdrawCompleteFile'].show(data)
			},
			goPay(){
				this.$router.replace({
					name: 'payment',
					query: {
						order_id: this.form.id,
						order: this.form.id,
						from: this.$route.path
					}
				})
			},
			resetFile() {
				this.$refs['file-recind'].showOn(this.form)
			},
			isOrder (data) {
				if (this.formProcess) {
					if (data) {
						return true
					} else {
						return false
					}
				} else {
					return true
				}
			},
			refreshData() {
				this.onChangeData()
			},
			changeFile() {
				this.onChangeData()
				this.$emit("chageData");
			},
			agentAnwser(data) {
				let type = ''
				if (!this.student_finish) {
					type = 'student'
					if (data.from == '（审核员）') {
						type = ''
					}
				}
				this.$refs['agent-anwser'].showOn(data, type)
			},
			rescind(data) {
				this.form.reason = data.reason
				this.form.reason_file = data.reason_file
				let reasonfileArr = data.reason_file.split("&");
				this.form.reasonfileArr = [];
				for (const i in reasonfileArr) {
					let itemobj = {
						id: i + 1,
						path: reasonfileArr[i],
						file: ''
					};
					let itemArr = itemobj.path.split("/")
					itemobj.path = itemArr[itemArr.length - 1]
					itemobj.file = itemArr.slice(0, 2).join("/");
					this.form.reasonfileArr.push(itemobj);
				}
				this.refresh()
			},
			orderRescind() {
				this.$refs['order-rescind'].showOn(this.form)
			},
			refresh(data) {
				this.$emit("chageData");
				this.dialogVisible = false
			},
			editOrder() {
				let data = this.form
				if (this.formProcess) {
					data = this.form.order
				}
				this.$refs['edit-order'].showOn(data)
			},
			closeDialog() {
				this.dialogVisible = false
			},
			sureHasPay() {
				this.$refs['sure-pay'].showOn(this.form)
			},
			intervalTime(date1,date2){
				return intervalTime(date1,date2)
			},
			showDialog(val, status, from, row) {
				this.status = status;
				this.role_id = this.$store.state.user.role_id;
				// if (this.role_id == 2) {
				//   this.myWidth = "70%";
				//   this.left_form = 24;
				// }
				if (from == 'formProcess') {
					this.getFinalsOrderInfo(val)
				} else {
					this.getOrderInfo(val)
				}
				if (row) {
					this.show_process = true
					this.showProcess(row, from)
				}
				this.dialogVisible = true
			},

			delOrderFn() {
				this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
						confirmButtonText: "确定",
						cancelButtonText: "取消",
						center: true,
						type: "warning"
					})
					.then(() => {
						delOrder(this.$axios, this.form.id)
							.then(({
								data
							}) => {
								if (data.status == "success") {
									this.$message.success("删除成功");
									this.dialogVisible = false;
									this.$emit("chageData");
									// this.$router.go(0)
								} else {
									this.$message.error(data.message);
								}
							})
							.catch(err => {
								this.$message.error(err);
							});
					})
					.catch(() => {
						this.$message({
							type: "info",
							message: "已取消删除"
						});
					});
			},

			//更新数据
			onChangeData() {
				if (this.formProcess) {
					this.getFinalsOrderInfo(this.form.id)
				} else {
					this.getOrderInfo(this.form.id);
				}
			},
			// 查看订单
			getOrderInfo(order) {
				orderJS.getOrderInfoFn(this.$axios, order, this);
			},
			// 查看定稿订单
			getFinalsOrderInfo(order) {
				orderJS.getFinalsOrderInfoShow(this.$axios, order, this);
			},

			//切换流程 和 审批意见
			handleClick(tab, event) {},

			//关闭查看弹窗
			handleClose(done) {
				this.form = {};
				this.fileListV=[];
				this.fileList=[];
				this.dialogVisible = false;
				this.isAnswer = null
			},

			//获取所有代理人信息
			getAllAgent() {
				getAgent(this.$axios)
					.then(res => {
						if (res.data.code == 200) {
							let arr = res.data.data;
							for (let key in arr) {
								//element的模糊匹配组件el-autocomplete指定：必须数组的每个元素是个对象，并且有value属性
								arr[key].value = arr[key].name;
							}
							this.restaurants = arr;
						}
					})
					.catch(err => {
						this.$message({
							type: "err",
							message: err
						});
					});
			},

			//输入抬头模糊匹配
			querySearch(queryString, cb) {
				let that = this;
				let restaurants = this.restaurants;
				let results = [];
				if (restaurants.length > 0) {
					results = queryString ? restaurants.filter(that.createFilter(queryString)) : restaurants;
				}
				// 调用 callback 返回建议列表的数据
				cb(results);
			},
			//匹配
			createFilter(queryString) {
				return restaurant => {
					return (
						restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
					);
				};
			},
			//模糊匹配赋值
			handleSelect(item) {
				this.formAgent.id = item.id;
				//需要在选择后把搜索建议输入框的错误提示去掉。注意应该用clearValidate()，不应该用resetFields()
				if (this.dialogFP) {
					this.$refs['ruleFormFP'].clearValidate();
				}
				if (this.innerVisible) {
					this.$refs['ruleFormAgent'].clearValidate();
				}
			},

			//分配代理人
			distributionAgent(id) {
				this.uploadFileGetAgent()
				this.dialogFP = true;
			},
			changeAgentFP (value) {
				let obj = {};
				obj = this.agentData.find((item)=>{
						return item.value === value;
				})
				this.selectAgentFP = obj
			},

			//国知局前变更代理人
			chageAgent(data) {
				this.$refs.orderEditAgent.show(data)
			},

			//提交分配代理人
			submitFormFP(formName) {
				this.$refs[formName].validate(valid => {
					if (valid) {
						let obj = {
							order: this.form.id,
							agent_id: this.formAgent.name
						};
						orderAgent(this.$axios, obj)
							.then(res => {
								if (res.data.status == "success") {
									this.$message({
										type: "success",
										message: "分配成功,已将订单" +
											this.form.order_number +
											"分配给代理人：" +
											this.selectAgentFP.name
									});
									this.$emit("chageData");
									this.dialogFP = false;
									this.dialogVisible = false;
									// this.$router.go(0)
									//发送邮件
									//this.$axios.post('/api/' + this.formAgent.id + '/send/' + this.form.id + '/email')
								} else {
									this.$message({
										type: "error",
										message: res.data.message
									});
								}
							})
							.catch(err => {
								this.$message({
									type: "error",
									message: err
								});
							});
					} else {
						return false;
					}
				});
			},
			//关闭修改代理人弹框
			handleCloseAgent() {
				if (this.$refs["changeAgentForm"]) {
					this.$refs["changeAgentForm"].resetFields()
				}
				// this.$refs["changeAgentForm"].resetFields()
				this.innerVisible = false;
			},
			//关闭分配代理人按钮
			handleCloseFP() {
				this.formAgent = {};
				this.dialogFP = false;
				this.resetForm("ruleFormFP");
			},
			//重置验证
			resetForm(formName) {
				this.$refs[formName].resetFields();
			},

			// 结束流程
			closeOrder() {
				if (this.form.is_cancel) {
					if (this.form.status == '待接单') {
						this.$refs['endProcess'].show(this.form.id)
					} else {
						this.$alert(`该代理人本月接单数为:${this.form.finish || 0}件,已撤案数为:${this.form.cancel || 0}件`, '温馨提示', {
							confirmButtonText: '确定',
							center: true,
							callback: action => {
							}})
					}
				} else {
					this.$refs['endProcess'].show(this.form.id)
				}
			},

			// 代理人显示编号加名称 刘某（001）
			agentNumAddName(value) {
				if(value) {
					if (value.email_work) {
						return `${value.name}（${value.email_work.split("@")[0].slice(-3)}）`
					} else {
						return value.name
					}
				} else {
					return ''
				}
			},

			// 免审
			exemptReview() {

			},
			// 代理人上传
			submitUpload(type = false) {
				let list = document.getElementsByClassName(
					"el-upload-list__item is-ready"
				);
				if (list.length == 0) {
					this.$message({
						type: "warning",
						message: "请选择需要上传的文件！"
					});
					return;
				}
				// FormData 对象
				var form = new FormData();
				// 免审文件数据处理
				if (type) {
					let free_check = []
					this.fileListV.forEach(v => {
						free_check.push(v.name)
					})
					form.append("free_check", free_check)
				}

				// 文件对象
				for (let i in this.fileListV) {
					form.append(i==0?"file":("file"+(i*1+1)), this.fileListV[i].raw);
				}
				let url = this.baseUrl + "/api/order/" + this.form.id + "/upload"
				if (this.$store.state.user.is_teacher == 2 && !this.student_finish) {
					url =  this.baseUrl + "/api/order/" + this.form.id + "/student_upload"
				}
				form.append("order", this.form.id);
				if (type) {
					this.$confirm('确认上传免审文件吗', '提示', {
						confirmButtonText: '确认',
						cancelButtonText: '取消',
						center: true,
						type: 'warning'
					}).then(() => {
						this.sumbitPost(url, form)
					}).catch(e => {})
				} else {
					this.sumbitPost(url, form)
				}
			},

			sumbitPost(url, form) {
				axios({
					method: "post",
					url: url,
					data: form,
					headers: {
						"Content-Type": "multipart/form-data",
						Authorization: "Bearer " + this.$store.state.token
					}
				}).then(res => {
					if (res.data.status == "success") {
						this.$message({
							type: "success",
							message: "上传成功"
						});
						this.$emit("chageData");
						this.handleClose();
					} else {
						this.$message({
							type: "error",
							message: res.data.message
						});
						this.fileListV=[];
						this.fileList=[];
					}
				}).catch (err => {
					console.log(err)
				})
			},

			handleRemove(file, fileList) {
				this.fileListV = fileList;
			},

			//选择后验证
			handleChange(file, fileList) {
				let tempList = [];//可以上传的文件
				for(let i = 0;i<fileList.length;i ++){
					let canUpload = true;//是否可以上传
					let that = this;
					//验证文件类型
					let fileName = fileList[i].name;
					//文件切成数组 然后去判断格式
					let fileNameArr = fileName.substring(that.form.order_number.length + 1).split("-");
					let arrLen = fileName.split("-").length;
					//1.获取后缀名 必须是文档格式(doc/docx)
					let pos = fileName.lastIndexOf(".");
					let lastName = fileName.substring(pos, fileName.length);
					let orderNum = fileName.substr(0, that.form.order_number.length);
					let typeArr = ['发明专利', '实用新型', '外观设计'] // 专利类型
					if (
						// lastName.toLowerCase() !== ".doc" &&
						lastName.toLowerCase() !== ".docx"
					) {
						that.$message.error("文件必须为.docx格式");
						canUpload = false;
						//2.拼接订单编号 判断编号是否一致
					}else if (orderNum != that.form.order_number) {
						that.$message.error("文件名中订单编号与订单不符合，请修改后重新上传");
						canUpload = false;
					}else if (that.form.status == "代理人撰写中") {
						if (fileNameArr.length != 3 && fileNameArr.length != 4) {
							that.$message.error('文件名格式不正确')
							canUpload = false;
						} else {
							let type_name = ''
							if (fileNameArr.length == 3) {
								type_name = fileNameArr[2]
							} else if (fileNameArr.length == 4) {
								type_name = fileNameArr[3]
							}
							if (fileNameArr[0] != that.form.agent.name  && fileNameArr[1] != that.form.agent.name) {
								that.$message.error("代理人姓名不一致");
								canUpload = false;
							}
							if (!/^(发明专利|实用新型|外观设计)$/.test(type_name.split(".")[0])) {
								that.$message.error("案件类型必须是【发明专利, 实用新型, 外观设计】中的一种");
								canUpload = false;
							}
							if(fileNameArr.length == 5){
								if (!(/^[0-9]{0,}$/.test(fileNameArr[0]))) {//序号
									that.$message.error("多报格式为订单编号后加'-数字'");
									canUpload = false;
								}
							}
						}
					}else if (that.form.status == "案件修改中") {
						if (fileNameArr.length != 4 && fileNameArr.length != 5) {
							that.$message.error('文件名格式不正确')
							canUpload = false;
						}else{
							if (!(/^R[0-9]{0,}$/.test(fileNameArr[fileNameArr.length - 1].split('.')[0]))) {//R号
								that.$message.error("文件名格式不正确");
								canUpload = false;
							}
							let type_name = ''
							if (fileNameArr.length == 4) {
								type_name = fileNameArr[2]
							} else if (fileNameArr.length == 5) {
								type_name = fileNameArr[3]
							}
							if (fileNameArr[0] != that.form.agent.name  && fileNameArr[1] != that.form.agent.name) {
								that.$message.error("代理人姓名不一致");
								canUpload = false;
							}
							if (!/^(发明专利|实用新型|外观设计)$/.test(type_name.split(".")[0])) {
								that.$message.error("案件类型必须是【发明专利, 实用新型, 外观设计】中的一种");
								canUpload = false;
							}
							if(fileNameArr.length == 5){
								if (!(/^[0-9]{0,}$/.test(fileNameArr[0]))) {//序号
									that.$message.error("多报格式为订单编号后加'-数字'");
									canUpload = false;
								}
							}
						}
					}
					if(canUpload){
						tempList.push(fileList[i]);
					}
				}
				this.fileListV.splice(0,this.fileListV.length,...tempList);
				fileList.splice(0,fileList.length,...tempList);
				return ;
			},
			//上传
			uploadSectionFile(params) {
			},
			closed() {
				this.student_upload = false
				this.student_finish = false
				this.show_process = false
				this.step_status = 'success'
				this.opDateMax = 1
			},
			openDialog () {

				// 给流程代理人 el-form 表单界面添加水印
				if (this.$store.state.user.role_id === 2 || this.$store.state.user.role_id === 4) {
					let doms = this.js_lookOrder_DOM.childNodes
					let elDialogBodyChilds = doms[1].childNodes
					let elRomChilds = elDialogBodyChilds[2].childNodes
					let elColChilds = elRomChilds[0].childNodes
					let bgPurpleChilds = elColChilds[0].childNodes
					for (let i = 0; i < bgPurpleChilds.length; i++) {
						if (bgPurpleChilds[i].className === 'el-form') {
							bgPurpleChilds[i].style.position = 'relative'
							bgPurpleChilds[i].appendChild(this.divDOM)
							return
						}
					}
				}

				// 恢复答复补正文件状态
				this.isAnswer = '1'
				this.isupdateAgent = false
			},
			handleChange1 (file, fileList) {
				if (this.isAnswer == '7') {
					this.uploadLimit = 1
					let tempList = [];//可以上传的文件
					let that = this;
					let canUpload = true;//是否可以上传
					let fileName,
							fileNameArr,
							arrLen,
							pos,
							lastName,
							orderNum =''
					for(let i = 0;i<fileList.length;i ++){
						// //验证文件类型
							fileName = fileList[i].name
							pos = fileName.lastIndexOf(".")
						// 后缀名
						lastName = fileName.substring(pos, fileName.length)
						if ( lastName.toLowerCase() !== ".pdf") {
							that.$message.error("文件必须为 pdf");
							canUpload = false;
						}
						if(canUpload){
							tempList.push(fileList[i]);
						}
					}
					this.fileList.splice(0,this.fileListV.length,...tempList);
					return
				} else {
					this.fileList = fileList
				}
			},
			submitAnswer (params) {
				let form = new FormData()
				for (let i in this.fileList) {
					form.append(i==0?"file":("file"+(i*1+1)), this.fileList[i].raw);
				}
				form.append('finals', this.form.id)
				let url = ''
				// 上传证书时
				if (this.isAnswer == '7') {
					url = `/api/finals/${this.form.id}/upload/cert`
				} else {
					url = `/api/finals/${this.form.id}/send/agent`
					form.append('type', this.isAnswer)
					let agentId = this.orderRow.agent.id
					if (this.isupdateAgent) {
						this.uploadFileGetAgent()
						this.reselectAgent = true
						return
					}
					if (params) {
						agentId = params
						form.append('agent_id', agentId)
					}
				}

				axios({
					method: "post",
					url: this.baseUrl + url,
					data: form,
					headers: {
						"Content-Type": "multipart/form-data",
						Authorization: "Bearer " + this.$store.state.token
					}
				}).then(res => {
					if (res.data.status == "success") {
						this.$message({
							type: "success",
							message: "上传成功"
						})
						this.handleCloseAgent()
						this.handleClose()
						this.fileList=[]
						// this.$emit('refresh', this.form)
						this.refresh()
						// this.$router.go(0)
					} else {
						this.$message({
							type: "error",
							message: res.data.message
						})
						// this.fileList=[]
						return false
					}
				})
			},
			parsingExcelAddData () {
			},
			orderTaking () {
				this.$emit('clickOrderTaking',this.form)
				this.dialogVisible = false
			},
			getProcessingTime(val) {
				return orderFn.getProcessingTime(val, 2); //从接单开始算
			},
			update (row) {
				this.$refs.updateDialog.show(row)
			},
			checkBack(list) {

			},
			uploadFileGetAgent () {
				this.$axios.get('api/user/agent').then(  res => {
					if (res.data.code == 200) {
						let data = res.data.data
						this.agentData = res.data.data.map( v => {
							v.label = v.name
							v.value = v.id
							return v
						})
					} else {
						this.$message.error(res.data.message)
					}
				})
			},
			showProcess(row, from){
				if (from == 'formProcess') {
					let list = row.statuss.map(item => item.id).reverse()
					this.steps_text = ['等待提交国知局', '已提交国知局', '补正/答复', '国知局审查中', '授权']
					if(list.includes(23)) {
						this.steps_text = ['等待提交国知局', '已提交国知局', '补正/答复', '国知局审查中', '授权']
						this.opDateMax = 4
					}else if(list.includes(22)) {
						this.steps_text = ['等待提交国知局', '已提交国知局', '补正/答复', '国知局审查中', '驳回']
						this.opDateMax = 4
					}else if(list.includes(21)) {
						this.opDateMax = 3
					}else if(list.includes(20)) {
						this.opDateMax = 2
					}else if(list.includes(19)) {
						this.opDateMax = 1
					}else if(list.includes(8)) {
						this.opDateMax = 0
					}
					if (row.status == '撤案') {
						this.steps_text.splice(this.opDateMax + 1)
						this.steps_text.push('已撤案')
						this.opDateMax ++
						this.step_status = 'error'
					}
				} else {
					this.steps_text = ['提交申请', '代理人接单', '案件撰写', '案件质控', '发送定稿文件', '发明人定稿', '案件上传', '递交国知局']
					let list = row.statuss.map(item => item.id)
					if (list.includes(8)) {
						this.opDateMax = 8
						return
					}
					if (list.includes(7)) {
						this.opDateMax = 7
						return
					}
					if (list.includes(13)) {
						this.opDateMax = 6
						return
					}
					if (list.includes(15)) {
						this.opDateMax = 4
						return
					}
					if (list.includes(10)) {
						this.opDateMax = 5
						return
					}
					if (list.includes(4)) {
						this.opDateMax = 4
						return
					}
					if (list.includes(3)) {
						this.opDateMax = 3
						return
					}
					if (list.includes(2)) {
						this.opDateMax = 2
						return
					}
					if (list.includes(1)) {
						this.opDateMax = 1
						return
					}
				}

			},
			reselectUpload (formName) {
				this.$refs[formName].validate((valid) => {
					if (valid) {
						// this.isUpdateAgent = true
						this.isupdateAgent = false
						this.submitAnswer(this.formAgent.name)
						this.reselectAgent = false
          } else {
						return false
					}
				})

			},
			// 补充订单按钮
			supplementOrder (formData) {
				this.$refs.supplementOrder.show(formData)
			},
			// 更新订单状态
			updateOrderStatus (formData) {
				this.$refs.updateOrderStatusDialog.show(formData)
			},
			// 修改代理人
			editAgent (data) {
				this.getAllAgent()
				this.$refs.editAgentDialog.show(data)
			},
			showTextarea(item, index) {
				for(let i = 0; i < this.form.allOpinions.length; i++) {
					this.form.allOpinions[i].show_input = false;
					if (i == index) {
						this.form.allOpinions[i].show_input = true
					}
				}
			},
			submitMessage(data) {
				if (this.replyMessage == "") {
					this.$message({
						message: "请输入消息",
						type: "warning"
					});
				} else {
					this.submitMessagePost(data)
				}
			},
			submitMessagePost(data) {
				let params = {
					opinion_id: data.id,
					review: this.replyMessage,
					type: 'auditor'
				}
				this.$axios
					.post(`/api/order/${data.order_id}/agent_message`, params)
					.then(res => {
						if (res.data.code == 200) {
							this.$message({
								type: "success",
								message: "回复成功！"
							});
							this.replyMessage = ""
							this.refreshData()
						} else {
							this.$message({
								type: "error",
								message: res.data.message
							});
						}
					})
					.catch(e => {
						console.log(e);
					});
			},

		},
		mounted() {
			if (this.$store.state.user.role_id === 2 || this.$store.state.user.role_id === 4) {
				this.js_lookOrder_DOM = document.getElementById('js_lookOrder')
				this.js_lookOrder_DOM.classList.add("weaterMark_DOM")
				this.divDOM = Watermark(this.$store.state.user.name)
				this.js_lookOrder_DOM = document.querySelector('.weaterMark_DOM>.el-dialog')
			}
		},
		updated() {

		},
		watch:{
			dialogFP(val){
				if(!val){
					this.formAgent= {}
				}
			},
			innerVisible(val){
				if(!val){
					this.formAgent= {}
				}
			},
			form: {
				handler: function (val) {
					if (val.update_records) {
						if (val.update_records.length) {
								for (let i = 0; i < val.update_records.length; i++) {
									if( val.update_records[i].review instanceof Object ) {
										this.isUpdate = false
										break
									}  else {
										this.isUpdate = true
									}
								}
						} else {
							this.isUpdate = true
						}
					}
					if (val.change_agent_operation) {
						if (val.change_agent_operation.length) {

								this.isUpdateAgent = false
						} else {
							this.isUpdateAgent = true
						}
					}

					if (this.$store.state.user.is_teacher != 2) {
						this.student_finish = true
					} else {
						this.student_finish = false
						if (val.statuss) {
							if (val.statuss.findIndex(v => v.id == 5) > -1) {
								let statuss = val.statuss.slice(0, val.statuss.findIndex(v => v.id == 5))
								if (statuss.findIndex(v => v.id == 16) > -1) {
									if (statuss.findIndex(v => v.id == 17) > -1) {
										this.student_finish = true
										return this.student_upload = false
									}
									if (statuss.findIndex(v => v.id == 17) == -1 && statuss.findIndex(v => v.id == 18) == -1 && statuss.findIndex(v => v.id == 16) > -1) {
										return this.student_upload = true
									}
									if (statuss.findIndex(v => v.id == 18) > statuss.findIndex(v => v.id == 16)) {
										return this.student_upload = true
									}
								}
								if (val.statuss.findIndex(v => v.id == 5) < val.statuss.findIndex(v => v.id == 3)) {
									return this.student_upload = false
								}
							} else {
								if (val.statuss.findIndex(v => v.id == 17) > -1) {
									this.student_finish = true
									return this.student_upload = false
								}
								if (val.statuss.findIndex(v => v.id == 17) == -1 && val.statuss.findIndex(v => v.id == 18) == -1 && val.statuss.findIndex(v => v.id == 16) > -1) {
									return this.student_upload = true
								}
								if (val.statuss.findIndex(v => v.id == 18) > val.statuss.findIndex(v => v.id == 16)) {
									return this.student_upload = true
								}
							}
						}
					}

				},
				deep: true,
				immediate: true
			},
		}
	};
</script>
<style lang="less">
	.look_order {
		.btn_chage {
			/* width: 100%; */
			// margin-left: 50%;
			// transform: translateX(-50%);
			margin-bottom: 14px;
			text-align: center;
		}
		.orderTaking {
			width: 100%;
			// margin: 10px auto;
			margin: 10px 0;
			text-align: center;
		}
		/* .r-approval,
		.tab_menu {
		  min-height: 500px;
		}

		.item_tab {
		  height: 80px;
		} */
		.file_sh {
			font-size: 32px;
			margin-right: 40px;
		}

		.tips_1 {
			color: midnightblue;
			line-height: 20px;
		}

		.tips_2 {
			color: red;
			line-height: 20px;
		}

		.tips_3 {
			color: red;
			line-height: 20px;
			// color: rgb(218, 218, 218);
		}

		.file_content1 {
			position: relative;
			&.file {
				.el-form-item__content {
					position: absolute;
					top: 11%;
				}
			}

			.el-form-item__content {
				//height: 40px;
				-webkit-display: flex;
				display: flex;
				-webkit-align-items: center;
				align-items: center;
			}
		}

		.el-dialog__header {
			text-align: center;
			background-color: rgb(198, 226, 255);
		}

		/* .el-dialog__header .el-dialog__title{
		  font-size: 22px;
		} */

		.el-dialog {
			margin-top: 20px !important;
			width: 90% !important;
		}

		.el-form-item {
			height: 100%;
			border: 1px solid #ccc;
			margin-right: -1px;
			margin-bottom: -1px;
		}
		.el-col {
			.el-col-12{
				.el-form-item {
					border-bottom-width: 0;
				}
			}
			.el-col-24 {
				.el-form-item {
					border-bottom-width: 0;
				}
			}
		}
		.fontgreen {
			color: rgb(73, 150, 124);
			font-weight: 700;
		}
		.upload-demo-btns {
			z-index: 100;
			position: relative;
		}
	}


	.review_file {
		.el-form-item__content {
			height: 40px;
		}
	}
	.order_taking {
			margin: 10px auto;
			display: block;
	}
	.el-tabs {
		.el-tabs__content {
			overflow: visible;
			max-height: 895px;
			min-width: 340px;
			overflow-y: auto;

		}
	}
	.grid-content {
		.el-steps {

			.el-step {
				.el-step__main {
					padding-left: 20px;
					.el-step__title {
						color: #909399;
						font-size: 14px;
					}
				}
			}
			.el-step__icon-inner{
				display: none !important; //不要序号
			}
			.step-icon_user {
				color: #FFF;
				// margin-left: 10px ;
				font-size: 14px;
			}
			.step-title_user {
				color: green;
				margin-right: 10px ;
				font-size: 15px;
			}
			.el-step__line {
				display: none;
			}
			.el-step__icon {
				background: #409EFF;
				border: 0px;
				width: 28px;
				height: 28px;
			}
			.el-step__description {
				color: rgb(58, 58, 58);
			}
		}
	}

	.preview-img-wrap {
		display: flex;
		align-items: center;
		height: 40px;
		.el-image {
			width: 25px;
			height: 25px;
			margin-right: 10px;
			image {
					width: 100%;
					height: 100%;
					display: block;
			}
		}
	}
	.agentSeparated {
		display: inline-block;
		min-width: 40px;
		text-align: left;
	}
	.agentName {
		display: inline-block;
		min-width: 60px;
		text-align: left;
	}
	.oldAgent {
		color: #999;
	}
	.green {
		color: green;
		font-weight: 700;
	}
	.upload-wrap {
		display: flex;
		position: relative;
		.upload-demo {
			width: 400px;
			.el-upload-list__item-name {
				margin-right: 0px;
			}
		}
		.free-btn {
			position: absolute;
			line-height: 40px;
			left: 65px;
			margin-left: 15px;
			// .el-button {
			// 	height: 26px;
			// }

		}
		.free-wrap {
			margin-left: 10px;
			.checkbox-wrap {
				.el-checkbox-group {
					.el-checkbox {
						line-height: 20px;
						.el-checkbox__inner {
							border-color: #409EFF;
						}
						.el-checkbox__label {
							color: #409EFF;
						}
					}
				}
			}
			.checkbox-line {
				margin-top: 5px;
				height: 25px;
				display: flex;
				align-items: center;
				&:first-child {
					margin-top: 10px;
				}
			}
		}
	}
	.uploadAnswer {
		// margin:20px 0 0 120px;
		margin-top: 20px;
		.inlineblock {
			display: block;
		}
		.uploadSelect {
			width: 220px;
			margin-bottom: 10px;
		}
	}
	.agent-msg-wrap {
		margin-bottom: 10px;
		&:nth-last-child(1) {
			margin-bottom: 0;
		}
		.agent-msg-title {
			font-size: 14px;
			color: #909399;
			.msg-name {
				color: #409EFF;
				font-size: 15px;
				margin-right: 10px;
			}
		}
		.agent-msg {
			display: flex;
			.title {
				flex: 0 0 80px;
				color: #909399;
			}
			.content {
				flex: 1;
				color: #333;
				max-width: calc(100% - 85px);
			}
		}
	}

	.free-drop-menu {
		.el-dropdown-menu__item {
			padding: 0 10px;
			line-height: 0;
			.normal-btn {
				width: 90px;
				height: 26px;
				padding: 0;
				span {
					display: flex;
					align-items: center;
					justify-content: center;
				}
			}
		}
	}
	.free-file {
		position: relative;
		&::after {
			content: '';
			width: 5px;
			height: 5px;
			display: block;
			border-radius: 50%;
			background-color: red;
			position: absolute;
			right: 2px;
			top: 0;
		}
	}
	.msg-user {
		display: flex;
		justify-content: space-between;
		&.fl {
			width: calc(100% - 30px)
		}
	}
	.agetn-rate {
		margin-top: 12px;
	}
	.quickReply {
		.messagebox {
			width: 100%;
			background: #eef1f3;
		}

		.messageBackground_l {
			background: #fff;
		}
		.messageBackground_r {
			background: #c9e7ff;
		}
		.item {
			width: 100%;
			margin-bottom: 10px;
			.item_user {
				display: inline-block;
				width: 60px;
				font-size: 16px;
				font-weight: bold;
			}
			.item_message {
				max-width: calc(100% - 170px);
				display: inline-block;
				padding: 10px 15px;
				box-sizing: border-box;
				margin-left: 15px;
				border-radius: 5px;
				vertical-align: top;
				// margin-right: 90px;
			}
			.item_time {
				font-size: 12px;
				display: block;
				padding-left: 80px;
				margin-bottom: 5px;
				color: #ccc;
			}
			.deduction_message {
				margin: 20px 0 0 80px;
				max-width: calc(100% - 170px);
				padding: 10px 15px;
				border-radius: 5px;
			}
		}
		.agent_item {
			width: 100%;
			margin-bottom: 10px;
			position: relative;
			box-sizing: border-box;
			padding-top: 20px;
			.item_user {
				display: inline-block;
				width: 60px;
				font-size: 16px;
				font-weight: bold;
			}
			.item_time {
				position: absolute;
				right: 95px;
				top: 0px;
				font-size: 12px;
				display: block;
				// padding-right: 80px;
				margin-bottom: 5px;
				color: #ccc;
			}
			.item_message {
				max-width: calc(100% - 170px);
				display: inline-block;
				padding: 10px 15px;
				box-sizing: border-box;
				margin-right: 30px;
				border-radius: 5px;
				vertical-align: top;
				// margin-left: 80px;
			}
		}
		.ivu-tooltip {
			position: relative;
			z-index: 2000;
		}
	}
</style>
